package com.whmall.service.crm.module.company.service.impl;

import com.whmall.service.crm.entity.dto.company.CompanyAddReqDTO;
import com.whmall.service.crm.entity.dto.company.SupplierAccountReqDTO;
import org.apache.dubbo.common.utils.StringUtils;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author yangkuan
 * @Date 2020/8/5 16:25
 **/
@Component
public class CompanySupplierAddValidator {

    public void validate(SupplierAccountReqDTO supplierAccountReqDTO) {

        if (supplierAccountReqDTO == null) {
            throw new IllegalArgumentException("req不能为空");
        }

        if (supplierAccountReqDTO.getAccountType() == null) {
            throw new IllegalArgumentException("账户类型不能为空");
        }

        if (StringUtils.isEmpty(supplierAccountReqDTO.getAccount())) {
            throw new IllegalArgumentException("银行账号不能为空");
        }

        if (StringUtils.isEmpty(supplierAccountReqDTO.getAccountName())) {
            throw new IllegalArgumentException("户名不能为空");
        }

        if (supplierAccountReqDTO.getIsEnabled() == null) {
            throw new IllegalArgumentException("是否启用不能为空");
        }

    }

}
